package org.dromara.easyes.test.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.easyes.annotation.HighLight;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;

import java.util.Date;

/**
 * @since 2019-10-14 15:22
 * @since logan-web 1.0
 */
@Data
@Accessors(chain = true)
@IndexName(value="logan_log_detail-#{BY_MONTH}",shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true)
public class LoganLogDetailDTO implements Comparable<LoganLogDetailDTO> {
    @IndexId(type = IdType.CUSTOMIZE)
    private Long id;

    private long taskId;

    private int logType;

    private String content;
    @HighLight(mappingField = "highlightContent")
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.KEYWORD)
    private long logTime;

    private Date addTime = new Date();

    private Date updateTime = new Date();

    @Override
    public int compareTo(LoganLogDetailDTO o) {
        if (null == o) {
            return 0;
        }
        return id - o.getId() > 0 ? 1 : -1;
    }

}
